
ms.UIBinFang = ms.UILayer.extend({
	ctor: function() {
		this._super();
		this._ccsFileName = "binfang.json";
	},

	onEnter: function() {

		this._super();
        var layer = cc.LayerColor.create(cc.color.GRAY);
        this.addChild(layer, 100);
        var size = cc.director.getWinSize();

        var label = cc.LabelTTF.create("精神科病房", "Arial", 100);
        label.setColor(cc.color.BLACK);
        label.setPosition(cc.p(size.width * 0.5, size.height * 0.5));
        layer.addChild(label);

        var fadeOut = cc.FadeOut.create(1);
        var call  = cc.CallFunc.create(function() {
            layer.removeFromParent();
            this._continueButton.setVisible(false);

            var point = this._imageText.getPosition();
            this._imageText.y = -this._imageText.height;
            var moveTo = cc.MoveTo.create(0.5, point);
            this._imageText.runAction(moveTo);

            var bink = cc.Blink.create(1, 3);
            var repate = cc.RepeatForever.create(bink);
            this._kuang.runAction(repate);


        },this);

        label.runAction(cc.Sequence.create(fadeOut, call));

	},


	onKuangTouchEnded: function() {
        var move = cc.MoveBy.create(0.3, cc.p(520, 0));
        this._imageDanZhi.runAction(move);

        var move2 = cc.MoveBy.create(0.3, cc.p(0, -200));
        var call = cc.CallFunc.create(function() {
            this._continueButton.setVisible(true);
        }, this);
        this._imageText.runAction(cc.Sequence.create(move2, call));

	},

    onContinueButtonTouchEnded: function(sender) {
        if (!sender.isVisible()) {
            return;
        }

        cc.director.runScene(ms.createScene(ms.UIJianCha));
    }
});

